import { createRouter, createWebHistory } from 'vue-router'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Layout',
      component: () => import('@/views/layout/Layout.vue'),
      children: [
        {
          path: '/',
          name: 'index',
          component: () => import('@/views/index/index.vue')
        },
        {
          path: '/v/:pCategoryCode',
          name: 'CategoryVideo',
          component: () => import('@/views/videoList/CategoryVideo.vue')
        },
        {
          path: '/v/:pCategoryCode/:categoryCode',
          name: 'ChildCategoryVideo',
          component: () => import('@/views/videoList/CategoryVideo.vue')
        },
        {
          path: '/video/:videoId',
          name: 'videoDetail',
          component: () => import('@/views/videoDetail/VideoDetail.vue')
        }
      ]
    },
    {
      path: '/ucenter',
      name: 'Ucenter',
      redirect: '/ucenter/home',
      component: () => import('@/views/ucenter/UcLayout.vue'),
      children: [
        {
          path: '/ucenter/home',
          name: '用户中心首页',
          component: () => import('@/views/ucenter/Home.vue')
        },
        {
          path: '/ucenter/postVideo',
          name: '上传视频',
          component: () => import('@/views/ucenter/postVideo/Post.vue')
        },
        {
          path: '/ucenter/editVideo',
          name: '编辑视频',
          component: () => import('@/views/ucenter/postVideo/Post.vue')
        },
        {
          path: '/ucenter/video',
          name: '视频列表',
          component: () => import('@/views/ucenter/VideoList.vue')
        },
        {
          path: '/ucenter/comment',
          name: '评论管理',
          component: () => import('@/views/ucenter/CommentList.vue')
        },
        {
          path: '/ucenter/danmu',
          name: '弹幕管理',
          component: () => import('@/views/ucenter/DanmuList.vue')
        }
      ]
    }
  ]
})

export default router
